/*
 * Javlov - a Java toolkit for reinforcement learning with multi-agent support.
 * 
 * Copyright (c) 2009 Matthijs Snel
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package net.javlov.world;

import java.awt.Shape;
import java.util.List;

import net.javlov.Agent;
import net.javlov.Environment;


/**
 * Represents a "physical" world with objects in which the location of the objects, and of the
 * agent, is of importance. E.g. a grid world or continuous world in which the agent moves around.
 * 
 * @author Matthijs Snel
 *
 */
public interface World extends Environment<double[]> {
	
	public boolean addBody(Body b);
	public boolean add(Agent a, AgentBody b);
	
	public Body getAgentBody(Agent a);
	public List<Body> getObjects();
	public double getHeight();
	public double getWidth();
	//TODO get rid of this
	public double getTimeStep();
	
	public List<Body> getIntersectingObjects(Shape s);
	public boolean intersectsObject(Shape s);
	
	public boolean remove(Agent a);
	public boolean removeBody(Body b);
	
	public interface Continuous extends World {

		public void setWidth(double width);

		public void setHeight(double height);
		
		public boolean translateBody(Body b, double dx, double dy);
		
		public boolean rotateBody(Body b, double angle);
	}
	
	public interface Discrete extends World {
		public void setWidth(int width);

		public void setHeight(int height);
		
		public boolean translateBody(Body b, int dx, int dy);
		
		public boolean rotateBody(Body b, double angle);
	}
}
